const MusicHttp = require("../../utils/MusicHttp")
Page({

  data: {
    banner:[],
    hot:[],
    new:[],
    dj:[],
    currentCity:""
  },
  onLoad: async function (options) {
    
     var hotRes = await MusicHttp.getHotMusicHttp();
    // console.log(hotRes.data.playlists);
    var newRes = await MusicHttp.getNewMusicHttp();
    // console.log(newRes.data.albums);
    var djRes = await MusicHttp.getDjMusicHttp();
    // console.log(djRes.data.result);
    this.setData({
      hot:hotRes.data.playlists.slice(0,3),
      new:newRes.data.albums.slice(0,3),
      dj:djRes.data.result.slice(0,3)
    })
  },
  hotClick(){
    var url = `/top/playlist/highquallity`
    wx.navigateTo({
      url: `../detail/detail?url=${url}`,
    })
    wx.setNavigationBarTitle({
      title: '热门歌曲',
    })
  },
  newClick(){
    var url = `/album/newest`
    wx.navigateTo({
      url: `../detail/detail?url=${url}`,
    })
    wx.setNavigationBarTitle({
      title: '最新音乐',
    })
  },
  djClick(){
    var url = `/personalized/djprogram`
    wx.navigateTo({
      url: `../detail/detail?url=${url}`,
    })
    wx.setNavigationBarTitle({
      title: '主播电台',
    })
  },
})
